package com.catmiao.ai.config;

import com.catmiao.ai.service.WeatherService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import dev.langchain4j.agent.tool.P;
import dev.langchain4j.agent.tool.Tool;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class InvoiceHandler {

    @Tool
    public String handler(@P("companyName") String companyName,
                          @P("dutyNumber") String dutyNumber,
                          @P("amount") String amount
                          ) throws JsonProcessingException {

        log.info("companyName:{}, dutyNumber:{}, amount:{}", companyName, dutyNumber, amount);
        JsonNode weather = new WeatherService().getWeather("101010100");

        System.out.println(weather);
        return "ok";
    }

}
